package com.xuecheng.hmall;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@ApiModel(value="Item", description="商品表")
public class Item implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "商品id")
    @TableId(value = "id",type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "SKU名称")
    private String name;

    @ApiModelProperty(value = "价格（分）")
    private Integer price;

    @ApiModelProperty(value = "库存数量")
    private Integer stock;

    @ApiModelProperty(value = "商品图片")
    private String image;

    @ApiModelProperty(value = "类目名称")
    private String category;

    @ApiModelProperty(value = "品牌名称")
    private String brand;

    @ApiModelProperty(value = "规格")
    private String spec;

    @ApiModelProperty(value = "销量")
    private Integer sold;

    @ApiModelProperty(value = "评论数")
    private Integer commentCount;

    @ApiModelProperty(value = "是否是推广广告，true/false")
    @TableField("isAD")
    private Boolean isAD;

    @ApiModelProperty(value = "商品状态 1-正常，2-下架，3-删除")
    private Integer status;

    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间")
    private LocalDateTime updateTime;

    @ApiModelProperty(value = "创建人")
    private Long creater;

    @ApiModelProperty(value = "修改人")
    private Long updater;

}
//todo Java 中使用 Boolean 类型接收，MyBatis-Plus 会自动完成 tinyint(1) 与 Boolean 之间的转换：
//数据库值为 0 时，映射为 false
//数据库值为 1 时，映射为 true
